package com.yxc.plan.wolf.service.impl;

import com.yxc.plan.wolf.common.ServerResponse;
import com.yxc.plan.wolf.domain.Product;
import com.yxc.plan.wolf.domain.repository.ProductRepository;
import com.yxc.plan.wolf.service.interfaces.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @Description : 
* @Author      : abc@.com
* @Date        : 2019-01-15 13:43
*/
@Service
public class ProductServiceImpl implements ProductService {

    @Autowired
    private ProductRepository productRepository;

    @Override
    public ServerResponse<List<Product>> list(Pageable pageable) {
        Page<Product> productPage = productRepository.findAll(pageable);
        return ServerResponse.createBySuccess("访问成功", productPage.getContent());
    }
}
